#include <iostream>
using namespace std;

class Person
{
public:
    Person()
    {
        cout << "Person构造函数\n";
    }
    virtual ~Person()
    {
        cout << "Person析构函数\n";
    }
    virtual void run()
    {
        cout << "Person run\n";
    }

public:
    int m_age;
};
class Student : public Person
{
public:
    Student()
    {
        cout << "Student 构造函数\n";
    }
    ~Student()
    {
        cout << "Student 析构函数\n";
    }
    void run()
    {
        cout << "Student run\n";
    }
    void study()
    {
        cout << "Student study\n";
    }

public:
    int m_score;
};
int main()
{
    // char *str = "hello world";
    /*const 转 非 const*/
    // char *buffer = const_cast<char *>(str);
    /*非const 转 const*/
    // const char *dest = static_cast<const char *>(str);

    int a = 10;
    const int numa = static_cast<const int>(a);
    a = 20;
    std::cout << numa << std::endl;

    Person *p1 = new Student();
    p1->run();
    Person *p2 = new Person();
    Student *stu2 = static_cast<Student *>(p2); /*没有安全检测：stu2的地址置空*/
    cout << stu2 << endl;
    stu2->run();
    return 0;
}